﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BooksManagermentSystem
{
    public partial class AddPress_form : Form
    {
        public AddPress_form()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string pressname = textBox1.Text.Trim();

            if(pressname.Length == 0 )
            {
                MessageBox.Show("请输入出版社！");
                textBox1.Focus();
                return;
            }

            string sql = $"insert into Press values('{pressname}')";
            if(DBhelper.NonQuery(sql))
            {
                MessageBox.Show("添加成功！");
            }
            else
            {
                MessageBox.Show("添加失败！");
            }
        }
    }
}
